<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
    
    <body>
        <p:panel header="Gruplarım">
            <h:panelGrid columns="2">
                <h:panelGrid columns="2">
                <h:outputLabel value="Grup adı: "/>
                <h:outputLabel value="#{CommunityBean.target.name}"/>
                 <h:outputLabel value="Grup Yöneticisi: "/>
                 <c:if test="#{HomePageBean.userIsTeacher()==true}">
                        <p:commandLink value="#{CommunityBean.target.admin.fullName}" action="#{HomePageBean.clickTeacher()}" ajax="false">
                            <f:setPropertyActionListener value="#{CommunityBean.target.admin}" target="#{TeacherBean.target}"/>
			</p:commandLink>	
                 </c:if>
                 <c:if test="#{HomePageBean.userIsTeacher()==false}">
                         <p:commandLink value="#{CommunityBean.target.admin.fullName}" action="#{HomePageBean.clickStudent()}" ajax="false">
                             <f:setPropertyActionListener value="#{CommunityBean.target.admin}" target="#{StudentBean.target}"/>
			</p:commandLink>	
                 </c:if>
                 <p:commandButton value="Üye Ol" rendered="#{CommunityBean.memberOf==false}"  action="#{CommunityBean.joinCommunity()}"  ajax="false" style="margin-left:123px "/>
            </h:panelGrid>
                <p:commandButton value="Etkinlikleri Gör" onclick="groupEvents.show();"/>
            </h:panelGrid>    
            <p:menubar rendered="#{CommunityBean.communityAdmin()}">
                <p:menuitem value="Duyuru Ekle" icon="ui-icon-contact" onclick="newComAnnouncement.show();"/>
                <p:menuitem value="Etkinlik Ekle" icon="ui-icon-contact" onclick="newComEvent.show();"/>
                
                <p:menuitem value="Mail Gönder" icon="ui-icon-mail-closed" onclick="newComMail.show();" />
                <p:menuitem value="Grubu Kapat" icon="ui-icon-close" action="#{HomePageBean.clickBoxGroupDeleteGroup()}"  />
            </p:menubar>
            <p:menubar rendered="#{CommunityBean.memberOf}">
                <p:menuitem value="Üye Listesi" icon="ui-icon-person" onclick="members.show()" />
                <c:if test="#{CommunityBean.communityAdmin()==false}">
                    <p:menuitem value="Gruptan Çık" icon="ui-icon-close" action="#{HomePageBean.clickBoxGroupLeaveGroup()}"  />                         	
                </c:if>
            </p:menubar>
        </p:panel>
        <h:panelGrid rendered="#{CommunityBean.memberOf}" width="100%" columns="3">
                <h:panelGroup>
		    <p:panel header="Duyurular">
                        <p:dataList paginator="true" paginatorAlwaysVisible="3" value="#{CommunityBean.communityAnnouncement()}" var="ann">
				<p:column>
				    <h:panelGrid columns="2">
                                        <h:outputText escape="false" value="#{ann.text}"/>
                                           <c:if test="#{HomePageBean.userIsTeacher()==true}">
                                               <p:commandLink value="${ann.teacher.fullName}" action="#{HomePageBean.clickTeacher()}" >
                                                   <f:setPropertyActionListener value="#{ann.teacher}" target="#{TeacherBean.target}"/>
                                                </p:commandLink>	
                                          </c:if>
                                          <c:if test="#{HomePageBean.userIsTeacher()==false}">
                                              <p:commandLink value="${ann.community.admin.fullName}" action="#{HomePageBean.clickStudent()}" >
                                                  <f:setPropertyActionListener value="#{ann.community.admin}" target="#{CommunityBean.target}"/>
                                                </p:commandLink>	
                                          </c:if>
				    </h:panelGrid>
				</p:column>
			  </p:dataList>
		    </p:panel>
		</h:panelGroup>
            </h:panelGrid>
        
          <p:lightBox style="background: white;" id="box" visible="#{HomePageBean.box}" onHide="#{HomePageBean.makeBoxFalse()}" height="500" width="500">
		<h:outputLink value="#{HomePageBean.sayfaBox}" title="#{HomePageBean.boxTitle}"/>   
	  </p:lightBox>
        
    </body>
</html>
